﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OpenQuarters.WebQuarters.Core
{
    public class SessionItem
    {
        public static T GetItem<T>(string key, Func<T> defaultValue)
        {
            if (Oracle.Session[key] == null)
            {
                Oracle.Session[key] = defaultValue();
            }
            return (T)Oracle.Session[key];
        }

        public static void SetItem<T>(string key, T value)
        {
            Oracle.Session[key] = value;
        }
    }
}
